package cn.shop.ordersystem.controller;

import cn.shop.ordersystem.mapper.CategoryMapper;
import cn.shop.ordersystem.pojo.entity.FoodType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class FTcategoryController {
    @Autowired(required = false)
    CategoryMapper mapper;
    @RequestMapping("/category/insert")
    public List<FoodType> insertcategory(String title){
        mapper.insertcategory(title);
        return mapper.select();
    }
    @RequestMapping("/category/select")
    public List<FoodType> select(){
       return mapper.select();
    }
    @RequestMapping("/category/delete")
    public void deleteById(int id){
        mapper.deleteById(id);
    }
    @RequestMapping("/category/update")
    public void update(@RequestBody FoodType foodType){
        mapper.update(foodType);
    }
}
